package com.pastquestion;

public class Main11a {

	public static void main(String[] args) {
		int res = 0;
		for (int j = 1; j < 2021; j++) {
			int i = j;
			while(i > 0)
			{
				int n = i%10;
				if(n == 2)
					res++;
				i=i/10;
			}
		}
		System.out.println(res);
	}

}
